home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / util / crypt / ThorPGP50.lha / PGP50AddToKeyRing.thor next >
Text File  |  1992-09-02  |  2KB  |  86 lines

  1. /* $VER: PGPAddToKeyRing.thor 1.0 (14.01.98)
  2.  *
  3.  * Arexx script to add a PGP key to the public keyring. The key is taken
  4.  * from the current message in Thor.
  5.  *
  6.  * Main Script by: Eivind Nordseth, Ultima Thule Software.
  7.  * Adapted to PGP50 by: Kai Gunter Brandt, kgb@dataguard.no
  8.  */
  9.  
  10. /* trace results */
  11.  
  12. options results
  13.  
  14. p = ' ' || address() || ' ' || show('P',,)
  15. thorport = pos(' THOR.',p)
  16.  
  17. if thorport > 0 then thorport = word(substr(p,thorport+1),1)
  18. else
  19. do
  20.     say 'No THOR port found!'
  21.     exit 10
  22. end
  23.  
  24. if ~show('p', 'BBSREAD') then do
  25.     address command
  26.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  27.         "WaitForPort BBSREAD"
  28. end
  29.  
  30. filename = 't:pgptext'
  31.  
  32. address command 
  33. if exists(filename) then 'delete >nil:' filename
  34.  
  35. address(thorport)
  36. SAVEMESSAGE CURRENT FILE filename NOHEADER
  37. if(rc ~= 0) then 
  38. do 
  39.     REQUESTNOTIFY TEXT '"Not able to save current message."' BT '"_Ok"'
  40.     exit
  41. end
  42.  
  43. address command 'search >nil:' filename '"BEGIN PGP PUBLIC KEY" QUICK QUIET' 
  44. if(rc = 5) then
  45. do
  46.     REQUESTNOTIFY TEXT '"This message contains no PGP key."' BT '"_Ok"'
  47.     exit
  48. end
  49.  
  50. if(rc ~= 0) then
  51. do
  52.     REQUESTNOTIFY TEXT '"Search failed. Check path."' BT '"_Ok"'
  53.     exit
  54. end
  55.  
  56. GETGLOBALCONFIG CFG
  57. if(rc ~= 0) then exit
  58.  
  59. address BBSREAD GETGLOBALDATA stem GLOBALDATA
  60. if(rc ~= 0) then exit
  61.  
  62. Call Close 'STDOUT'          
  63. Call Close 'STDIN'
  64. Call Open 'STDOUT','CON:0/13//150/PGPAmiga/SCREEN' || CFG.PUBSCREENNAME
  65. Call Pragma '*','STDOUT'
  66. Call Open 'STDIN','*'
  67.  
  68. if GLOBALDATA.PGPCommand = '' then 
  69. do
  70.     call getpath
  71.     pgpcommand = result
  72. end
  73. else pgpcommand = GLOBALDATA.PGPCOMMAND
  74.  
  75. address command "sys:c/pgpk -a "filename
  76. if(rc ~= 0) then
  77. do
  78.     REQUESTNOTIFY TEXT '"PGP failed. Check Global Config or PGPPATH envirorment variable."' BT '"_Ok"'
  79.     exit
  80. end
  81.  
  82. if exists(filename) then address command 'delete >nil:' filename
  83. exit 0
  84.  
  85.  
  86.